package com.tanhua.management.contoller;

import cn.hutool.core.util.ObjectUtil;
import com.tanhua.management.service.LogService;
import com.tanhua.server.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Type;

/**
 * Create By Administrator on 2021/7/14.
 */
@RequestMapping("manage")
@RestController

public class LogController {
    @Autowired
    private LogService logService;


    @GetMapping("/logs")
    public ResponseEntity getLogslist(Type type,Integer page, Integer pageSize){

        try {
            PageResult pageResult = this.logService.queryLogsList(type,page, pageSize);
            if (ObjectUtil.isNotEmpty(pageResult)) {
                return ResponseEntity.ok(pageResult);
            }
        } catch (Exception e) {
            //log.error(" 查询出错 ",e);
        }
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
    }
}
